home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / bc_pas_1.zip / DIALOGA.ASM < prev    next >
Assembly Source File  |  1992-07-09  |  6KB  |  380 lines

  1. ;$Author:   BCRANE  $
  2. ;$Date:   09 Jul 1992 16:41:02  $
  3. ;$Header:   W:/sccs/mixers/dialoga.asv   1.2   09 Jul 1992 16:41:02   BCRANE  $
  4. ;$Log:   W:/sccs/mixers/dialoga.asv  $
  5. ;  
  6. ;     Rev 1.2   09 Jul 1992 16:41:02   BCRANE
  7. ;  changed jnc to jc in _dlgflush...
  8. ;  
  9. ;     Rev 1.1   23 Jun 1992 16:46:26   DCODY
  10. ;  PAS2 update
  11. ;  
  12. ;     Rev 1.0   15 Jun 1992 09:41:22   BCRANE
  13. ;  Initial revision.
  14. ;$Logfile:   W:/sccs/mixers/dialoga.asv  $
  15. ;$Modtimes$
  16. ;$Revision:   1.2  $
  17.  
  18.         Title Media Vision Dialog Video backup code
  19.     page    64,131
  20.  
  21.     ;; modified to support large model, June 19,1991 Kevin Norman
  22.  
  23. ;   /*\
  24. ;---|*|----====< DIALOGA.ASM >====----
  25. ;---|*|
  26. ;---|*| Initialize and setup the access to the mixers, volume, filter, etc
  27. ;---|*|
  28. ;   |*|  Media Vision, Inc. Copyright (c) 1991, All Rights Reserved
  29. ;---|*|
  30. ;   \*/
  31.  
  32.     .xlist
  33.     include model.inc
  34.         include masm.inc
  35. ;;;;;;;;include target.inc
  36.         .list
  37.  
  38. if MODELSIZE eq 0
  39.     .code
  40. else
  41.     .data
  42. endif
  43.  
  44. NumLockState    db    0        ; holds the NumLock state
  45. lasttime    dw    0        ; holds the last clock tic
  46.  
  47.         public  leftvolume
  48. leftvolume    dw    0
  49.     public    leftswitch
  50. leftswitch    db    0
  51.     public    ritvolume
  52. ritvolume    dw    0
  53.     public    ritswitch
  54. ritswitch    db    0
  55.     public    VolumeNumber
  56. VolumeNumber    dw    0
  57.     public    VolumeSwitch
  58. VolumeSwitch    db      0
  59.     public    Left2LeftState
  60. Left2LeftState  dw      0
  61.     public    Left2RightState
  62. Left2RightState dw    0
  63.     public    Right2LeftState
  64. Right2LeftState dw    0
  65.     public    Right2RightState
  66. Right2RightState dw     0
  67.  
  68.         .code
  69.  
  70.  
  71. ;   /*\
  72. ;---|*|----====< DecodeCrossChannel ( char * ) >====----
  73. ;---|*|
  74. ;---|*| Back up the whole thing
  75. ;---|*|
  76. ;   \*/
  77.     public    DecodeCrossChannel
  78. DecodeCrossChannel proc
  79.     push    bp
  80.     mov    bp,sp
  81.     push    es
  82.     push    si
  83.  
  84. if @datasize
  85.     les    si,dParm1
  86. else
  87.     push    ds
  88.     pop    es
  89.     mov    si,wParm1
  90. endif
  91.  
  92.     cld
  93.  
  94.         lods    byte ptr es:[si]
  95.     inc    si
  96.     cmp    al,02dh         ; '-'
  97.         sbb     ax,ax                   ; ax = -1 if '+'
  98.     mov    Left2LeftState,ax
  99.  
  100.     lods    byte ptr es:[si]
  101.     inc    si
  102.     cmp    al,02dh         ; '-'
  103.     sbb    ax,ax
  104.     mov    Left2RightState,ax
  105.  
  106.     lods    byte ptr es:[si]
  107.     inc    si
  108.     cmp    al,02dh         ; '-'
  109.     sbb    ax,ax
  110.     mov    Right2LeftState,ax
  111.  
  112.     lods    byte ptr es:[si]
  113.     cmp    al,02dh         ; '-'
  114.     sbb    ax,ax
  115.     mov    Right2RightState,ax
  116.  
  117.     pop    si
  118.         pop     es
  119.     pop    bp
  120.     ret
  121.  
  122. DecodeCrossChannel endp
  123.  
  124.  
  125. ;   /*\
  126. ;---|*|----====< DecodeMixer ( char * ) >====----
  127. ;---|*|
  128. ;---|*| Back up the whole thing
  129. ;---|*|
  130. ;   \*/
  131.     public    DecodeMixer
  132. DecodeMixer    proc
  133.     push    bp
  134.     mov    bp,sp
  135.     push    es
  136.     push    si
  137.  
  138. if @datasize
  139.     les    si,dParm1
  140. else
  141.     push    ds
  142.     pop    es
  143.     mov    si,wParm1
  144. endif
  145.  
  146.     cld
  147.  
  148.     call    FFAR ptr getnumber    ; get the percentage
  149.     jc    demi_bad
  150.     mov    leftvolume,ax
  151.  
  152.     lodsb                ; get the switch
  153.     mov    leftswitch,al
  154.     inc    si            ; move past the tab
  155.  
  156.     call    FFAR ptr getnumber    ; get the percentage
  157.     jc    demi_bad
  158.     mov    ritvolume,ax
  159.  
  160.     lodsb                ; get the switch
  161.     mov    ritswitch,al
  162. ;
  163. demi_bad:
  164.     pop    si
  165.         pop     es
  166.     pop    bp
  167.     ret
  168.  
  169. DecodeMixer    endp
  170.  
  171.  
  172. ;   /*\
  173. ;---|*|----====< DecodeVolumeNumber ( char * ) >====----
  174. ;---|*|
  175. ;---|*| Back up the whole thing
  176. ;---|*|
  177. ;   \*/
  178.     public    DecodeVolumeNumber
  179. DecodeVolumeNumber    proc
  180.     push    bp
  181.     mov    bp,sp
  182.     push    es
  183.     push    si
  184.  
  185. if @datasize
  186.     les    si,dParm1        ;*****
  187. else
  188.     push    ds
  189.     pop    es
  190.     mov    si,wParm1
  191. endif
  192.  
  193.     cld
  194.     call    FFAR ptr getnumber    ; get the percentage
  195.     jc    devn_bad
  196.     mov    VolumeNumber,ax
  197. ;
  198. devn_bad:
  199.     pop    si
  200.         pop     es            ;*****
  201.     pop    bp
  202.     ret
  203.  
  204. DecodeVolumeNumber    endp
  205.  
  206.  
  207. ;   /*\
  208. ;---|*|----====< DecodeVolumeSwitch ( char * ) >====----
  209. ;---|*|
  210. ;---|*| Back up the whole thing
  211. ;---|*|
  212. ;   \*/
  213.     public    DecodeVolumeSwitch
  214. DecodeVolumeSwitch    proc
  215.     push    bp
  216.     mov    bp,sp
  217.     push    es
  218.     push    si
  219. if @datasize
  220.     les    si,dParm1
  221. else
  222.     push    ds
  223.     pop    es
  224.     mov    si,wParm1
  225. endif
  226.  
  227.     cld
  228.  
  229.     lods    byte ptr es:[si]
  230.     mov    VolumeSwitch,al
  231.  
  232.         pop     si
  233.         pop     es            ;*****
  234.     pop    bp
  235.     ret
  236.  
  237. DecodeVolumeSwitch    endp
  238.  
  239.  
  240. ;   /*\
  241. ;---|*|----====< _dlgflushfile (int handle) >====----
  242. ;---|*|
  243. ;---|*| This function makes a duplicate file handle, then
  244. ;---|*| closes the duplicate. This forces the file to be flushed.
  245. ;---|*|
  246. ;   \*/
  247.     public    _dlgflushfile
  248. _dlgflushfile    proc
  249.     push    bp
  250.     mov    bp,sp
  251.  
  252.     mov    bx,wParm1
  253.     mov    ah,45h
  254.     int    21h
  255.     jc    thisisbad
  256.  
  257.     mov    bx,ax
  258.     mov    ah,3eh
  259.     int    21h
  260.  
  261. thisisbad:
  262.     pop    bp
  263.     ret
  264.  
  265. _dlgflushfile    endp
  266.  
  267.  
  268. ;   /*\
  269. ;---|*|----====< _dlggettimedelta() >====----
  270. ;---|*|
  271. ;---|*| This function returns a 0 or 1 if a clock tic occured
  272. ;---|*|
  273. ;   \*/
  274.     public    _dlggettimedelta
  275. _dlggettimedelta       proc
  276.     mov    ah,0
  277.     int    1Ah
  278.     sub    ax,ax
  279.     cmp    lasttime,dx        ; ax = delta of current/last time
  280.     mov    lasttime,dx
  281.     adc    ax,0
  282.     ret
  283.  
  284. _dlggettimedelta  endp
  285.  
  286.  
  287. ;   /*\
  288. ;---|*|----====< _dlgrestorenumlock ( ) >====----
  289. ;---|*|
  290. ;---|*| This function restores the numlock state
  291. ;---|*|
  292. ;   \*/
  293.     public    _dlgrestorenumlock
  294. _dlgrestorenumlock    proc
  295.     push    es            ; save es
  296.  
  297.         sub     ax,ax
  298.     mov    es,ax
  299.  
  300.         mov     al,NumLockState
  301.     or    es:[417h],al        ; possibly set it
  302.  
  303.         pop     es
  304.     ret
  305.  
  306. _dlgrestorenumlock      endp
  307.  
  308.  
  309. ;   /*\
  310. ;---|*|----====< _dlgsavenumlock ( ) >====----
  311. ;---|*|
  312. ;---|*| This function restores the numlock state
  313. ;---|*|
  314. ;   \*/
  315.     public    _dlgsavenumlock
  316. _dlgsavenumlock proc
  317.     push    es                ; save the numlock state
  318.  
  319.         sub     ax,ax
  320.     mov    es,ax
  321.  
  322.     mov    al,20h
  323.     and    al,es:[417h]
  324.     and    byte ptr es:[417h],0dfh     ; clear it...
  325.     mov    NumLockState,al
  326.  
  327.         pop     es
  328.     ret
  329.  
  330. _dlgsavenumlock endp
  331.  
  332.  
  333. ;   /*\
  334. ;---|*|----====< getnumber ( char far * ) >====----
  335. ;---|*|
  336. ;---|*| convert ASCII # into binary
  337. ;---|*|
  338. ;---|*| entry conditions:
  339. ;---|*|    ES:SI points to the string
  340. ;---|*|
  341. ;---|*| Exit Conditions:
  342. ;---|*|    AX holds a number
  343. ;---|*|    SI points past the non-numeric character
  344. ;---|*|
  345. ;   \*/
  346.  
  347. getnumber    proc
  348.     cld
  349.     sub    bx,bx
  350.     sub    ax,ax
  351. ;
  352. genu_05:
  353.     lods    byte ptr es:[si]
  354.     sub    al,30h
  355.     jb    genu_done
  356.     cmp    al,9
  357.     ja    genu_done
  358.     shl    bx,1            ; bx = bx * 2
  359.     mov    cx,bx
  360.     shl    bx,1            ; bx = bx * 4
  361.     shl    bx,1            ; bx = bx * 8
  362.     add    bx,cx            ; bx = bx * 10
  363.     add    bx,ax
  364.     jmp    short genu_05
  365. ;
  366. genu_done:
  367.     mov    ax,bx
  368.     clc
  369.         ret
  370.  
  371. getnumber    endp
  372.  
  373.  
  374. ;   /*\
  375. ;---|*| end of DIALOGA.ASM
  376. ;   \*/
  377.  
  378.         end
  379.  
  380.